/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2019-2022. All rights reserved.
 * Description:hcom 执行器信息获取
 * Author:wangwenwen
 * Create:2019-12-10
 */

#include "executor_message.h"

namespace hccl {
using namespace std;
ExecutorMessage::ExecutorMessage() : isGatherAlltoAll_(false), statusCallback_(nullptr),
    messageType_(ExecutorMessageType::MSG_OPBASED) {}
ExecutorMessage::~ExecutorMessage() {}
void ExecutorMessage::SetOperationMessage(const HcomOperation_t& opInfo)
{
    hcomOperationInfo_ = opInfo;
    messageType_ = ExecutorMessageType::MSG_OPBASED;
}

ExecutorMessageType ExecutorMessage::GetMessageType()
{
    return messageType_;
}

HcomOperation_t ExecutorMessage::GetOperationMessage() const
{
    return hcomOperationInfo_;
}

void ExecutorMessage::SetRemoteOperationMessage(const HcomRemoteOperationParams& opInfo)
{
    hcomRemoteOperationInfo_ = opInfo;
    messageType_ = ExecutorMessageType::MSG_REMOTE_OP;
}

HcomRemoteOperationParams ExecutorMessage::GetRemoteOperationMessage() const
{
    return hcomRemoteOperationInfo_;
}

void ExecutorMessage::SetAlltoAllMessage(const HcomAllToAllVParams& opInfo, bool isGatherAlltoAll)
{
    hcomAlltoAllInfo_ = opInfo;
    isGatherAlltoAll_ = isGatherAlltoAll;
    messageType_ = ExecutorMessageType::MSG_ALLTOALL;
}

HcomAllToAllVParams ExecutorMessage::GetAlltoAllMessage() const
{
    return hcomAlltoAllInfo_;
}

void ExecutorMessage::SetAlltoAllVCMessage(const HcomAllToAllVCParams& opInfo)
{
    hcomAlltoAllVCInfo_ = opInfo;
    messageType_ = ExecutorMessageType::MSG_ALLTOALLVC;
}

HcomAllToAllVCParams ExecutorMessage::GetAlltoAllVCMessage() const
{
    return hcomAlltoAllVCInfo_;
}

void ExecutorMessage::SetRemoteAccessMessage(const std::string& remoteAccessType)
{
    remoteAccessInfo_.remoteAccessType = remoteAccessType;
    messageType_ = ExecutorMessageType::MSG_REMOTE_ACCESS;
}

const RemoteAccessInfo& ExecutorMessage::GetRemoteAccessMessage() const
{
    return move(remoteAccessInfo_);
}

void ExecutorMessage::SetStatusCallback(StatusCallback callBack)
{
    statusCallback_ = callBack;
}

StatusCallback ExecutorMessage::GetStatusCallback() const
{
    return statusCallback_;
}
}